<!DOCTYPE html>
<html>
<head>
    <title>私人订制：明信片和个性化邮票</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- head 中 -->
    <link rel="stylesheet" th:href="@{/jquery-weui/lib/weui.css}">
    <link rel="stylesheet" th:href="@{/jquery-weui/css/jquery-weui.css}">
    <link rel="stylesheet" th:href="@{/jquery-weui/css/demos.css?t=12}">
    <style>
        .hd{
            border-radius: 8px;
            width:96%;
            height: 210px;
        }
    </style>
</head>

<body>
    <div class="main">
        <div style="height: 30px"></div>
        <table style="width: 100%;height: auto">
            <tr>
                <td style="text-align: center">
                    <table style="width: 100%;height: 50px">
                        <td style="text-align: left;padding-left: 10px;"><img src="/stamp/image/post.png" style="width: 120px;height: 32px"></td>
                        <td style="font-size: 23px;font-weight: bolder;color: #9d9d9d" id="xmmc"></td>
                    </table>
                </td>

            </tr>
            <tr><td style="height: 10px;"></td></tr>
            <!--这里循环输出活动内容-->
            <tbody id="nr">

            </tbody>
        </table>
    </div>
<div style="height: 80px;background: white"></div>
<!-- body 最后 -->
<script type="text/javascript" th:src="@{/jquery-weui/lib/jquery-2.1.4.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/jquery-weui/lib/fastclick.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/jquery-weui/js/jquery-weui.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/jsfiles/crypto-js.min.js?t=1}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/jsfiles/com.js}" charset="utf-8"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
    });
    var xm_id = "[[${xm_id}]]";
    var adminUrl = "[[${adminUrl}]]";
    //后端地址
    var url = "[[${serverUrl}]]/stamp/h5/api/";
    //图片显示
    var url1 = "[[${serverUrl}]]/stamp/tp/";
    function init_data(){
        $.showLoading("数据加载中...");
        var jsonData = {
            xm_id: xm_id,
            timestamp:new Date().getTime()
        };
        var sendStr = {
            data:encrypt_str(JSON.stringify(jsonData),localStorage.getItem("a_h5"),localStorage.getItem("b_h5"))
        };
        $.ajax({
            type:"post",
            url:url+"get_hd",
            data:JSON.stringify(sendStr),
            dataType:"json",
            timeout : 10*1000, //超时时间设置，单位毫秒
            crossDomain: true,
            contentType: 'application/json;charset=UTF-8',
            headers: {
                "token": localStorage.getItem("token_h5")
            },
            beforeSend: function(request) {
                request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            },
            success:function(result){
                //console.info("result:"+JSON.stringify(result));
                if (result.code==0){
                    let rtn = decrypt_str(result.data,localStorage.getItem("a_h5"),localStorage.getItem("b_h5"));
                    console.info("rtn:"+rtn);
                    rtn = JSON.parse(rtn);
                    //渲染页面数据
                    $("#xmmc").html(rtn.stampXm.xsmc);
                    var str="";
                    rtn.stampHdList.forEach(function(item) {
                        str+="<tr>\n" +
                            "                <td style=\"text-align: center\"><img src=\""+url1+"hdzs?id="+item.urlId+"\" onclick=\"go_add('"+item.urlId+"','"+item.lxId+"');\" class='hd'>&nbsp;</td>\n" +
                            "            </tr>";
                    });
                    $("#nr").html(str);
                    var rank = $(window).height()/3.9;
                    $('.hd').css({
                        "height": rank+"px"
                    })
                }else if (result.code==500){
                }else {
                }
            },
            error:function(result){

            },complete:function(){
                $.hideLoading();
            }
        });
    }

    init_data();

    function go_add(id,lx){
        if (lx=="1")
        {
            parent.location.href=adminUrl+"/h5/card/add?hd_id="+id+"&xm_id="+encodeURIComponent(xm_id)+"";
        }
        else if (lx=="2")
        {
            parent.location.href=adminUrl+"/h5/card/gxh_add?hd_id="+id+"&xm_id="+encodeURIComponent(xm_id)+"";
        }
    }

</script>

</body>
</html>
